package h.a.a.j;

import h.a.a.h.a;
import h.a.a.h.c;

/* compiled from: TableStatements */
public class e {
    public final a a;
    public final String b;
    public final String[] c;
    public final String[] d;
    public c e;
    public c f;
    public c g;
    public c h;
    public c i;
    public volatile String j;
    public volatile String k;
    public volatile String l;

    public e(a aVar, String str, String[] strArr, String[] strArr2) {
        this.a = aVar;
        this.b = str;
        this.c = strArr;
        this.d = strArr2;
    }

    public c a() {
        if (this.h == null) {
            c e = this.a.e(d.c(this.b, this.d));
            synchronized (this) {
                if (this.h == null) {
                    this.h = e;
                }
            }
            if (this.h != e) {
                e.close();
            }
        }
        return this.h;
    }

    public c b() {
        if (this.f == null) {
            c e = this.a.e(d.d("INSERT OR REPLACE INTO ", this.b, this.c));
            synchronized (this) {
                if (this.f == null) {
                    this.f = e;
                }
            }
            if (this.f != e) {
                e.close();
            }
        }
        return this.f;
    }

    public c c() {
        if (this.e == null) {
            c e = this.a.e(d.d("INSERT INTO ", this.b, this.c));
            synchronized (this) {
                if (this.e == null) {
                    this.e = e;
                }
            }
            if (this.e != e) {
                e.close();
            }
        }
        return this.e;
    }

    public String d() {
        if (this.j == null) {
            this.j = d.e(this.b, "T", this.c, false);
        }
        return this.j;
    }

    public String e() {
        if (this.k == null) {
            StringBuilder stringBuilder = new StringBuilder(d());
            stringBuilder.append("WHERE ");
            d.a(stringBuilder, "T", this.d);
            this.k = stringBuilder.toString();
        }
        return this.k;
    }

    public c f() {
        if (this.g == null) {
            String str = this.b;
            String[] strArr = this.c;
            String[] strArr2 = this.d;
            int i = d.a;
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append('\"');
            stringBuilder.append(str);
            stringBuilder.append('\"');
            str = stringBuilder.toString();
            stringBuilder = new StringBuilder("UPDATE ");
            stringBuilder.append(str);
            stringBuilder.append(" SET ");
            for (int i2 = 0; i2 < strArr.length; i2++) {
                String str2 = strArr[i2];
                stringBuilder.append('\"');
                stringBuilder.append(str2);
                stringBuilder.append('\"');
                stringBuilder.append("=?");
                if (i2 < strArr.length - 1) {
                    stringBuilder.append(',');
                }
            }
            stringBuilder.append(" WHERE ");
            d.a(stringBuilder, str, strArr2);
            c e = this.a.e(stringBuilder.toString());
            synchronized (this) {
                if (this.g == null) {
                    this.g = e;
                }
            }
            if (this.g != e) {
                e.close();
            }
        }
        return this.g;
    }
}
